<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Auth_model
 * @Auth Andy zhu
 * @Create 2015-05-04
 *
 */
class Customer_links_model extends  Db_model
{

  private  $id 			= 0;
  private  $user_info 	= array();

  function __construct(){
  		parent::__construct();
        //$this->load->model("table_model");
  }


	function index($idCard=1){


	}

    function getLinks($idCard=1){
	  $condition  	= array("target"=> $idCard);
	  $fields 		= "id,name,source,target";
	  $one			= $this->table_model->get_array("customer_links",$condition,$fields);
	  $result 		=  array();
	  foreach($one  as $row){
	  	  $result[]      = $row;
		  $condition  	= array("target"=> $row["source"]);
		  $fields 		= "id,name,source,target";
		  $two			= $this->table_model->get_array("customer_links",$condition,$fields);

		  foreach($two  as $val){
			  $result[] = $val;
			  $condition  	= array("target"=> $row["source"]);
			  $fields 		= "id,name,source,target";
			  $three		= $this->table_model->get_array("customer_links",$condition,$fields);
			  foreach($three  as $rec){
					 $result[] = $val;
			  }
		  }

	  }

	  return $result;

  }



}
?>
